package cn.wizzer.app.task.commons.ext.quartz.job;

import cn.wizzer.app.user.modules.services.account.UserRechargeService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * Created by Wizzer.cn on 2015/6/27.
 */
@IocBean
public class RechargeOrderJob implements Job {

    private static final Log log = Logs.get();
    @Inject
    @Reference
    protected UserRechargeService rechargeService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        rechargeService.update(Chain.make("status",3),
                Cnd.where("status","=","0")
                        .and("ctAt", "<=",System.currentTimeMillis()/1000-(60*30)));
    }
}
